<!DOCTYPE html>
<html class="x-admin-sm" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>新建排课</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="/static/css/font.css">
    <link rel="stylesheet" href="/static/css/xadmin.css">
    <link rel="stylesheet" href="/static/ztree/css/metroStyle/metroStyle.css">
    <link rel="stylesheet" href="/static/lib.layui/css/layui.css">
    <script src="/static/js/jquery.min.js" charset="utf-8"></script>
    <script src="/static/lib/layui/layui.js" charset="utf-8"></script>
    <script src="/static/js/ztree.js" charset="utf-8"></script>
    <script src="/static/js/excheck.js" charset="utf-8"></script>
    <script type="text/javascript" src="/static/js/xadmin.js"></script>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row">
        <input type="hidden" id="studentIds" name="studentIds" required="" lay-verify="required"
               autocomplete="off" class="layui-input" th:value="${studentIds}">
        <form class="layui-form">

            <div class="layui-form-item">
                <label for="extension1" class="layui-form-label">
                    <span class="x-red">*</span>学生名
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="studentName" name="studentName" required="" lay-verify="required"
                           autocomplete="off" class="layui-input" th:value="${studentName}">
                </div>

                <label for="grade" class="layui-form-label">
                    <span class="x-red">*</span>年级
                </label>
                <div class="layui-input-inline">
                    <select id="grade" name="extension1">
                        <option value="1">一年级</option>
                        <option value="2">二年级</option>
                        <option value="3">三年级</option>
                        <option value="4">四年级</option>
                        <option value="5">五年级</option>
                        <option value="6">六年级</option>
                        <option value="7">初一</option>
                        <option value="8">初二</option>
                        <option value="9">初三</option>
                        <option value="10">高一</option>
                        <option value="11">高二</option>
                        <option value="12">高三</option>
                    </select>
                </div>
            </div>


            <div class="layui-form-item">
                <label for="extension1" class="layui-form-label">
                    <span class="x-red">*</span>排课科目
                </label>
                <div class="layui-input-inline">
                    <select id="extension1" name="extension1">
                        <option value="1">语文</option>
                        <option value="2">数学</option>
                        <option value="3">英语</option>
                        <option value="4">物理</option>
                        <option value="5">化学</option>
                        <option value="6">生物</option>
                        <option value="7">地理</option>
                        <option value="8">历史</option>
                        <option value="9">政治</option>
                    </select>
                </div>

                <label for="teacherName" class="layui-form-label">
                    <span class="x-red">*</span>教师名
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="teacherName" name="teacherName" required="" lay-verify="required"
                           autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label for="classDate" class="layui-form-label">
                    <span class="x-red">*</span>上课日期
                </label>
                <div class="layui-input-inline">
                    <input type="text" name="classDate" id="classDate" lay-verify="date" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
                </div>

                <label for="timeLimit" class="layui-form-label">
                    <span class="x-red">*</span>时间区间
                </label>
                <div class="layui-input-inline">
                    <input type="text" class="layui-input" id="timeLimit" placeholder="HH:mm:ss-HH:mm:ss">
                </div>
            </div>

            <div class="layui-form-item">
                <label for="classType" class="layui-form-label">
                    <span class="x-red">*</span>上课类型
                </label>
                <div class="layui-input-inline">
                    <select id="classType" name="classType">
                        <option value="1">A级课程</option>
                        <option value="2">1对1</option>
                        <option value="3">1对2</option>
                        <option value="4">3-6班组</option>
                        <option value="5">7-12班组</option>
                    </select>
                </div>

                <label for="classNum" class="layui-form-label">
                    <span class="x-red">*</span>课时
                </label>
                <div class="layui-input-inline">
                    <input type="text" name="classNum" id="classNum" lay-verify="date" autocomplete="off" class="layui-input">
                </div>
            </div>



            <div class="layui-form-item">
                <button  class="layui-btn" lay-filter="add" lay-submit="" style="margin-left: 111px;">
                    添加
                </button>
            </div>
        </form>
    </div>
</div>
<script>
    layui.use(['form', 'layer'],
        function() {
            $ = layui.jquery;
            var form = layui.form,
                layer = layui.layer;
            //监听提交
            form.on('submit(add)',function(data){
                $.ajax({
                    url:"/scheduleclass/attendClass/plan",
                    type:"post",
                    dateType:'json',
                    data:{
                        "studentIds" : $("#studentIds").val(),
                        "studentName" : data.field.studentName,
                        "classLevel": $("#grade").val(),
                        "course": $("#extension1").val(),
                        "teacherName": data.field.teacherName,
                        "beginClassDate":data.field.classDate,
                        "limitTime":data.field.timeLimit,
                        "classType":$("#classType").val(),
                        "extand2":$("#classNum").val()

                    },
                    success:function(result){
                        if(result.code == 0){
                            layer.alert("添加成功",{icon:6},function(){
                                //关闭当前frame
                                xadmin.close();
                                // 可以对父窗口进行刷新
                                xadmin.father_reload();
                            });

                        }

                    }
                });
                return false;
            });




        });

    layui.use(['laydate','form'], function(){
        var laydate = layui.laydate;
        //执行一个laydate实例
        laydate.render({
            elem: '#classDate' //指定元素
        });

        //时间选择器
        laydate.render({
            elem: '#timeLimit'
            ,type: 'time'
            ,range: true
        });

    });
</script>

</body>

</html>
